<?php

// 获取私人定制分页列表
// GET ctrl.self.volist
// http://sg.io/api?ctrl.self.volist

namespace app\api\resource\ctrl\self;
use think\Db;
use app\api\lib\Page;

class Volist
{
    // 方法
    public $_method = ['GET'];
    // 前置
    public $_pre    = [];
    // public $_pre    = ['member'];
    // 描述
    public $_description = '获取私人定制分页列表';
    // 参数
    public $_param  = [
        'page'   => '请求页,默认1',
        'show'   => '请求记录数量,默认20',
        'status' => '状态,默认全部,0-待受理 1-已受理 2-已完结 9-废弃',
    ];

    public function run(&$request)
    {
        $page     = $request->get('page/d',1);
        $show     = $request->get('show/d',10);
        $status   = $request->param('status/d',-1);
        
        $table    = 'self_form';
        $where    = '';
        if (-1 != $status) $where[]  = ['status','=',$status];
        $order    = 'status,create_time DESC';
        $pagelist = Page::run($table,$where,$order,$page,$show);

        // p($pagelist);die;

        return [200,$pagelist];
    }
}
